home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 3 / Amiga Tools 3.iso / grafik / raytracing / rayshade-4.0.6.3 / unapplied / ray2hf / text0000.txt < prev   
Encoding:
Text File  |  1994-08-09  |  4.1 KB  |  174 lines

  1. Wes Hardaker writes:
  2. >Has anyone made any patches that will allow rayshade to output a
  3. >height field rather than a image?  (IE, closer points in white,
  4. >farther in black).
  5.  
  6. I made a hack to do this.  I was going to do random dot stereograms
  7. with the output.  Never got around to the stereograms but my ray2hf
  8. seemed to kind-o-sort-of work.
  9.  
  10. I've attached my diffs.
  11.  
  12. WARNING: this is a hack.
  13. WARNING: it's also a hand pieced together set of diffs
  14. --
  15. Paul Chamberlain  |  <I do NOT speak for IBM!>    | UNIX: tif@austin.ibm.com
  16. IBM AWS, I/O Dev  |  512/838-3759, IBM T/L 678    | IBM-VNET:  TIF AT AUSTIN
  17.  
  18.  
  19. *** src/libshade/Makefile    Wed Aug 26 13:26:39 1992
  20. --- ray2hf/libshade/Makefile    Tue Aug 17 14:29:32 1993
  21. ***************
  22. *** 25,31 ****
  23.   INCLUDE = -I.. -I$(LIBRAYDIR)
  24.   YFLAGS = -d
  25.   
  26. ! CFLAGS = $(CCFLAGS) $(URTINC) $(INCLUDE) $(OPTIMIZE)
  27.   SHELL = /bin/sh
  28.   
  29.   LIB = libshade.a
  30. --- 25,31 ----
  31.   INCLUDE = -I.. -I$(LIBRAYDIR)
  32.   YFLAGS = -d
  33.   
  34. ! CFLAGS = $(CCFLAGS) $(URTINC) $(INCLUDE) $(OPTIMIZE) -DRAY2HF
  35.   SHELL = /bin/sh
  36.   
  37.   LIB = libshade.a
  38.  
  39.  
  40.  
  41. *** src/libshade/picture.c    Tue Aug 17 11:47:38 1993
  42. --- ray2hf/libshade/picture.c    Tue Aug 17 11:53:01 1993
  43. ***************
  44. *** 289,295 ****
  45.       } else
  46.           Options.pictfile = stdout;
  47.   
  48. !     fprintf(Options.pictfile,"%d %d\n",Screen.xsize, Screen.ysize);
  49.   
  50.       (void)fflush(Options.pictfile);
  51.   }
  52. --- 289,295 ----
  53.       } else
  54.           Options.pictfile = stdout;
  55.   
  56. !     fprintf(Options.pictfile,"P5\n%d %d\n255\n",Screen.xsize, Screen.ysize);
  57.   
  58.       (void)fflush(Options.pictfile);
  59.   }
  60. ***************
  61. *** 301,309 ****
  62.       register int i;
  63.   
  64.       for (i = 0; i < Screen.xsize; i++) {
  65. !         (void)fputc((int)CORRECT(buf[i].r), Options.pictfile);
  66. !         (void)fputc((int)CORRECT(buf[i].g), Options.pictfile);
  67. !         (void)fputc((int)CORRECT(buf[i].b), Options.pictfile);
  68.       }
  69.       (void)fflush(Options.pictfile);
  70.   }
  71. --- 301,308 ----
  72.       register int i;
  73.   
  74.       for (i = 0; i < Screen.xsize; i++) {
  75. !         fprintf(stderr,"alpha=%f\n",buf[i].alpha);
  76. !         (void)fputc((int)(buf[i].alpha), Options.pictfile);
  77.       }
  78.       (void)fflush(Options.pictfile);
  79.   }
  80.  
  81.  
  82. *** src/libshade/viewing.c    Wed Aug 26 13:26:39 1992
  83. --- ray2hf/libshade/viewing.c    Tue Aug 17 14:22:01 1993
  84. ***************
  85. *** 239,245 ****
  86. --- 239,247 ----
  87.       color->r *= Sampling.filter[u][v];
  88.       color->g *= Sampling.filter[u][v];
  89.       color->b *= Sampling.filter[u][v];
  90. + #ifndef RAY2HF
  91.       color->alpha *= Sampling.filter[u][v];
  92. + #endif
  93.   }    
  94.   
  95.   void
  96. ***************
  97. *** 281,286 ****
  98. --- 283,289 ----
  99.       dist = FAR_AWAY;
  100.       hitlist.nodes = 0;
  101.       (void)TraceRay(ray, &hitlist, EPSILON, &dist);
  102. + #ifndef RAY2HF
  103.       ShadeRay(&hitlist, ray, dist, &Screen.background, &ctmp, &fullintens);
  104.       color->r = ctmp.r;
  105.       color->g = ctmp.g;
  106. ***************
  107. *** 287,292 ****
  108. --- 290,299 ----
  109.       color->b = ctmp.b;
  110.       if (hitlist.nodes != 0) {
  111.           color->alpha = 1.;
  112. + #else
  113. +     if (hitlist.nodes != 0) {
  114. +         color->alpha = dist;
  115. + #endif
  116.       } else {
  117.           color->alpha = 0.;
  118.       }
  119.  
  120.  
  121. *** src/rayshade/Makefile    Wed Aug 26 13:26:45 1992
  122. --- ray2hf/rayshade/Makefile    Tue Aug 17 14:29:44 1993
  123. ***************
  124. *** 32,38 ****
  125.   # If you are running on a Multimax, add -DMULTIMAX -DSHAREDMEM
  126.   # 
  127.   
  128. ! CFLAGS = $(CCFLAGS) $(INCLUDE) $(OPTIMIZE)
  129.   
  130.   #
  131.   # C-Linda flags, if appropriate
  132. --- 32,38 ----
  133.   # If you are running on a Multimax, add -DMULTIMAX -DSHAREDMEM
  134.   # 
  135.   
  136. ! CFLAGS = $(CCFLAGS) $(INCLUDE) $(OPTIMIZE) -DRAY2HF
  137.   
  138.   #
  139.   # C-Linda flags, if appropriate
  140.  
  141.  
  142.  
  143. *** src/rayshade/raytrace.c    Wed Aug 26 13:26:45 1992
  144. --- ray2hf/rayshade/raytrace.c    Tue Aug 17 14:27:19 1993
  145. ***************
  146. *** 262,268 ****
  147. --- 262,270 ----
  148.           pix->r *= Sampling.filter[x][y];
  149.           pix->g *= Sampling.filter[x][y];
  150.           pix->b *= Sampling.filter[x][y];
  151. + #ifndef RAY2HF
  152.           pix->alpha *= Sampling.filter[x][y];
  153. + #endif
  154.       }
  155.   
  156.       sampnum = 0;
  157. ***************
  158. *** 287,293 ****
  159. --- 289,297 ----
  160.                   pix->r += ctmp.r*Sampling.filter[x][y];
  161.                   pix->g += ctmp.g*Sampling.filter[x][y];
  162.                   pix->b += ctmp.b*Sampling.filter[x][y];
  163. + #ifndef RAY2HF
  164.                   pix->alpha += ctmp.alpha*Sampling.filter[x][y];
  165. + #endif
  166.               }
  167.               if (++sampnum == Sampling.totsamples)
  168.                   sampnum = 0;
  169.  
  170. ----------
  171. Administrivia: rayshade-users-request@cs.princeton.edu
  172. Mailing list: rayshade-users@cs.princeton.edu
  173.  
  174.